import { JobOrderService } from 'src/app/@core/services/jobOrder/job-order.service';
import { JobOrderProcess } from './../../../../@core/data/job';
import { Component, Input } from '@angular/core';
import { DialogService } from '@devui';
import { EncodeRulesService } from 'src/app/@core/services/encoderRule/encode-rules.service';
import { AttachmentComponent } from 'src/app/@shared/components/attachment/attachment.component';
import { SelectPositionComponent } from 'src/app/@shared/components/select-position/select-position.component';
import { SelectUserComponent } from 'src/app/@shared/components/select-user/select-user.component';

@Component({
  selector: 'app-inspection-item-add',
  templateUrl: './inspection-item-add.component.html',
  styleUrls: ['./inspection-item-add.component.scss'],
})
export class InspectionItemAddComponent {
  @Input() data: any;
  radioValue = '否';
  inspection = {
    inspectionProjectId: 0,
    inspectionProjectName: '',
    inspectionProjectDescription: '',
    inspectionProjectUnit: '',
    attachments: [],
  };
  fujianNumber: number;
  constructor(
    private dialogService: DialogService,
  ) {}
  ngOnInit(): void {}
  onButtonClick(dialogtype?: string) {
    const results = this.dialogService.open({
      title: '质检项附件',
      width: '800px',
      backdropCloseable: false,
      data: {
        data: '销售附件',
        urls: this.inspection.attachments,
      },
      content: AttachmentComponent,
      dialogtype: dialogtype,
      onClose: () => {},
      buttons: [
        {
          cssClass: 'stress',
          text: '确定',
          handler: ($event: Event) => {
            this.inspection.attachments.push(results.modalContentInstance.urls);
            results.modalInstance.hide();
            this.fujianNumber = this.inspection.attachments.length;
          },
        },
        {
          id: 'btn-cancel',
          cssClass: 'common',
          text: '取消',
          handler: ($event: Event) => {
            results.modalInstance.hide();
          },
        },
      ],
    });
  }
}
